package com.yunqiao.admin.modules.job.task;

import com.yunqiao.service.sys.SysUserService;
import com.yunqiao.service.sys.entity.SysUserEntity;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 测试定时任务(演示Demo，可删除)
 *
 * testTask为spring bean的名称
 *
 * @author Mark wangxw725@163.com
 * @since 1.2.0 2016-11-28
 */
@Component("testTask")
public class TestTask {
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private SysUserService sysUserService;

	public void test(String params){
		logger.info("我是带参数的test方法，正在被执行，参数为：" + params);
		try {
			Thread.sleep(1000L);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		SysUserEntity user = sysUserService.getById(1L);
		System.out.println("==========SysUser:"+user);
		System.out.println(ToStringBuilder.reflectionToString(user));
		System.out.println("=============哈哈哈哈哈");
	}


	public void test2(){
		logger.info("我是不带参数的test2方法，正在被执行");
	}
}
